<template>
  <div>
    <!-- 输入 -->
    <p :style="{ color: theme1.color }">D 节点（注入）</p>
    <p :style="{ color: theme.color }">D 节点（本身）</p>
    <hr />
  </div>
</template>

<script>
export default {
  inject: {
    theme1: {
      // 防止注入的和本身的变量名冲突 from
      from: "theme",
      default: () => ({}),
    },
  },
  data() {
    return {
      theme: { color: "purple" },
    };
  },
};
</script>
